package com.common.util;

public class StringUtil {

	/**
	 * 产生由数字和字母组成的指定长度的的无重复的随机数
	 * 
	 * @param length
	 * @return
	 */
	public static String getRandomCode(int j) {
		// 定义验证码的字符表
		String chars = "0123456789abcdefghijklmnopqrstuvwxyz";

		char[] rands = new char[j];

		for (int i = 0; i < j; i++)

		{
			int rand = (int) (Math.random() * 36);
			rands[i] = chars.charAt(rand);
		}
		return new String(rands);
	}

	public static void main(String[] args) {
		String picName = "asdf.adfstxt88";
		String picExt = picName.substring(picName.lastIndexOf(".") + 1, picName
				.length());
		System.out.println(picExt);
	}
}
